package com.ruoyi.modules.service.impl;

import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.modules.domain.Contract;
import com.ruoyi.modules.mapper.ContractMapper;
import com.ruoyi.modules.service.ContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 字典 业务层处理
 *
 * @author tlgen
 */
@Service
public class ContractServiceImpl implements ContractService
{
    @Autowired
    private ContractMapper contractMapper;

    /**
     * 根据条件分页查询签约合同
     */
    @Override
    public List<Contract> selectContractList(Contract contract)
    {
        return contractMapper.selectContractList(contract);
    }


    /**
     * 根据签约合同ID查询信息
     */
    @Override
    public Contract selectContractById(Long contractId)
    {
        return contractMapper.selectContractById(contractId);
    }

    @Override
    public Contract selectNewCreateByFirstName(String firstName) {
        return contractMapper.selectNewCreateByFirstName(firstName);
    }

    /**
     * 批量删除签约合同信息
     */
    @Override
    public int deleteContractByIds(Long[] contractIds)
    {
        int row = contractMapper.deleteContractByIds(contractIds);
        if (row > 0)
        {
            DictUtils.clearDictCache();
        }
        return row;
    }

    /**
     * 新增保存签约合同信息
     */
    @Override
    public int insertContract(Contract Contract)
    {
        int row = contractMapper.insertContract(Contract);
        if (row > 0)
        {
            DictUtils.clearDictCache();
        }
        return row;
    }

    /**
     * 修改保存签约合同信息
     */
    @Override
    public int updateContract(Contract Contract)
    {
        int row = contractMapper.updateContract(Contract);
        if (row > 0)
        {
            DictUtils.clearDictCache();
        }
        return row;
    }

    @Override
    public List<Contract> selectContractByName(String firstName) {
        return contractMapper.selectContractByName(firstName);
    }

}
